package com.test.tget;


import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.FileOutputStream;
import java.io.InputStream;


import android.app.Activity;
import android.content.Intent;
import android.content.res.AssetManager;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.Menu;
import android.widget.Toast;

public class StartActivity extends Activity {
	
	public Handler mHandler = new Handler(){
		public void handleMessage(Message msg){
			//Intent mainview = new Intent(getApplicationContext(), SocketMainActivity.class);
			Intent mainview = new Intent(getApplicationContext(), MainActivity.class);
			mainview.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
			startActivity(mainview);
			
			finish();
		}
	};
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
		
		/*
		 *  업데이트 체크 
		 */
		
		super.onCreate(savedInstanceState);
		setContentView(R.layout.start);
		
		/*
		 *  로그인처리 
		 *  프로세스가 완료되면 핸들러로 이동 
		 */
		new DataTask().execute();
	}
	
	/**
	 *  분할된 파일을 합치는 작업
	 * @author tget
	 *
	 */
	class DataTask extends AsyncTask<Boolean, Boolean, Boolean>{

		@Override
		protected Boolean doInBackground(Boolean... arg0) {
			
			return true;
			
			
		}

		@Override
		protected void onPostExecute(Boolean result) {
			
			if(result){
				mHandler.sendEmptyMessageDelayed(0, 700);
			}else{
				Toast.makeText(getApplicationContext(), "로그인 오류", Toast.LENGTH_LONG).show();
				//finish(); // 앱종료
			}
		}

	}
	
	

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.start, menu);
		return true;
	}
	
	

}
